-- @owner: @zhangbingliang
-- @date: 2025-07-31
-- @testpoint: pg库使用fetch_status函数测试，合理报错
-- @modify: modified by @zhangbingliang at 2025-07-31

--step1:连接pg库
@conn PrimaryDbPGmode;

--step2:创建空表
drop table if exists t_fetch0015;
CREATE TABLE t_fetch0015 (ID INT);

--step3:调用游标后使用fetch_status函数查询;expect:报错
begin; /
DECLARE cur_fetch0015 CURSOR FOR SELECT ID FROM t_fetch0015; /
FETCH NEXT FROM cur_fetch0015;
select @@FETCH_STATUS; 
CLOSE cur_fetch0015;
end;

--step4:清理环境
drop table if exists t_fetch0015;